<?php 
use PsiFramework\Plugins\Recaptcha\Classes\Tools\Captcha;

use PsiFramework\Classes\Util\UI\LanguageManager;

use \PsiFramework\Classes\Util\UI\Printer;
use \PsiFramework\Classes\Util\UI\HTML;

$lang = LanguageManager::getInstance()->getLanguage();
$user = $response->getAttribute("user");
$captcha = Captcha::getInstance();
$error = $response->getAttribute("error");
?>
<div id="register">
    <?php
    if ($error != null) {
        ?>
    <div id="formError" class="error">
        <?php Printer::display($error);?>
    </div>
    <?php 
    }
    ?>
    <form
        class="editForm"
        action="<?php Printer::display(HTML::linkHref('action=Register'));?>"
        method="POST" enctype="multipart/form-data">
        <input
            type="hidden"
            name="redirectAction"
            value="Index" />
        <fieldset class="label oblig">
            <label class="titre" for="loginBox">
                <?php Printer::display($languageManager->getText("LOGIN_NAME")); ?> : 
            </label>
            <input
                class="firstInput"
                type="text"
                name="login"
                id="loginBox"
                value="<?php if ($user!=null && $user->getLogin() != null) Printer::display($user->getLogin()); ?>"
                required="required" />
        </fieldset>
        <fieldset class="label oblig">
            <label class="titre" for="passwordBox">
                <?php Printer::display($languageManager->getText("PASSWORD")); ?> : 
            </label>
            <input
                type="password"
                name="password"
                class="firstinput checkEqual:confirmPasswordBox"
                id="passwordBox"
                value=""
                required="required" />
        </fieldset>
        <fieldset class="label oblig">
            <label class="titre" for="confirmPasswordBox">
                <?php Printer::display($languageManager->getText("CONFIRM_PASSWORD")); ?> : 
            </label>
            <input
                class="firstInput"
                type="password"
                name="confirmPassword"
                id="confirmPasswordBox"
                value=""
                required="required" />
        </fieldset>
        <fieldset class="label oblig">
            <label class="titre" for="emailBox">
                <?php Printer::display($languageManager->getText("EMAIL")); ?> : 
            </label>
            <input
                class="firstInput"
                type="email"
                name="email"
                id="emailBox"
                value="<?php if ($user!=null && $user->getEmail() != null) Printer::display($user->getEmail()); ?>"
                required="required" />
        </fieldset>
        <?php
        if ($captcha != null) $captcha->showCaptchaCode($lang);
        ?>
        <input
            type="submit"
            value="<?php Printer::display($languageManager->getText("SUBMIT")); ?>"
            />
    </form>
</div>
